package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * ClassName: CommonController
 * Package: com.sky.controller.admin
 * Description: 通用类
 *
 * @Author 小龙
 * @Create 2025/9/26 4:14
 * @Version 1.0
 */
@RestController
@RequestMapping("/admin/common")
@Slf4j
@Api(tags = "通用接口")
public class CommonController {

    @Autowired
    private FileService fileService;

    /**
     * /admin/common/upload
     * @param file
     * @return
     */
    @ApiOperation("文件上传")
    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) {
        log.info("上传文件名：{}",file);

        String url = fileService.fileUpload(file);

        return Result.success(url);
    }


}
